//
//  CreateTableViewCell.m
//  图片故事
//
//  Created by 大帅逼 on 16/1/6.
//  Copyright © 2016年 helloApp. All rights reserved.
//

#import "CreateTableViewCell.h"
#import "Header.h"
#define MARGIN 20

@interface CreateTableViewCell ()


@end

@implementation CreateTableViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {

    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        // 初始化子控件
        _iconImageView = [[UIImageView alloc] init];
        
        [self.contentView addSubview:_iconImageView];
        
        _titleLabel = [[UILabel alloc] init];
        
        [_titleLabel setTextColor:[UIColor whiteColor]];
        
        [_titleLabel setFont:[UIFont systemFontOfSize:16]];
        
        [self.contentView addSubview:_titleLabel];
        
        _lineView = [[UIView alloc] init];
        
        [_lineView setBackgroundColor:[UIColor whiteColor]];
        
        [_lineView setAlpha:0.5];
        
        [self.contentView addSubview:_lineView];
        
        _msgLabel = [[UILabel alloc] init];
        
        [_msgLabel setTextColor:[UIColor whiteColor]];
        
        [_msgLabel setFont:[UIFont systemFontOfSize:12]];
        
        [_msgLabel setTextAlignment:NSTextAlignmentRight];
        
        [self.contentView addSubview:_msgLabel];
    }
    return self;
}

- (void)layoutSubviews {
    
    [super layoutSubviews];
    
    // 设置子控件位置
    [_iconImageView setFrame:CGRectMake(MARGIN, 10, My_Height(30), My_Height(30))];
    [_titleLabel setFrame:CGRectMake(60, 10, My_Width(280), My_Height(30))];
    [_msgLabel setFrame:CGRectMake(SCREEN_W - My_Height(200), 10, My_Width(160), My_Height(30))];
    [_lineView setFrame:CGRectMake(MARGIN, My_Height(49.5), SCREEN_W - 20, 0.5)];
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

@end
